import 'dart:ui';

import 'package:extended_tabs/extended_tabs.dart';
import 'package:flutter/material.dart';
import 'package:live_music/components/ui/theme.dart';
import 'package:live_music/pages/friendList/page_view/friend_list.dart';
import 'package:live_music/pages/publish/widget/friend_list.dart';
import 'package:live_music/pages/publish/widget/topic_list.dart';
import 'package:live_music/pages/topic/page_view/topic_list.dart';

class TopicListPublishIndexPage extends StatefulWidget {
  const TopicListPublishIndexPage({Key key}) : super(key: key);

  @override
  State<TopicListPublishIndexPage> createState() =>
      _TopicListPublishIndexPageState();
}

class _TopicListPublishIndexPageState extends State<TopicListPublishIndexPage>
    with SingleTickerProviderStateMixin {
  TabController _tabController;
  final List<Widget> _tabsContent = [
    TopicListPublish(type: 1),
    TopicListPublish(type: 2)
  ];
  final List<Widget> _tabs = [Text('最新话题'), Text('热门话题')];
  @override
  void initState() {
    super.initState();
    _tabController = TabController(
      initialIndex: 1,
      length: _tabs.length,
      vsync: this,
    );
  }

  @override
  Widget build(BuildContext context) {
    double screenWidth = MediaQuery.of(context).size.width;
    return
        // Column(children: [
        //   Container(
        //       height: 30,
        //       width: 0.55 * screenWidth,
        //       child: ExtendedTabBar(
        //         indicatorSize: TabBarIndicatorSize.label,
        //         controller: _tabController,
        //         indicatorColor: Colors.red,
        //         indicatorWeight: 2,
        //         unselectedLabelStyle: TextStyle(
        //             color: Colors.grey[600], // 下划线颜色
        //             fontSize: 14,
        //             fontWeight: FontWeight.w600),
        //         labelStyle: TextStyle(
        //             color: Colors.white,
        //             fontSize: 14,
        //             fontWeight: FontWeight.w700), //标签文字大小颜色
        //         tabs: _tabs,
        //       )),
        //   Container(
        //     height: MediaQuery.of(context).size.height - kToolbarHeight - 40,
        //     color: Colors.white,
        //     child: ExtendedTabBarView(
        //       controller: _tabController,
        //       children: _tabsContent,
        //     ),
        //   )
        // ]);

        Container(
            margin: EdgeInsets.only(
                top: MediaQueryData.fromWindow(window).padding.top),
            child: Scaffold(
                appBar: AppBar(
                  centerTitle: true,
                  title: Container(
                      width: 0.55 * screenWidth,
                      child: ExtendedTabBar(
                        indicatorSize: TabBarIndicatorSize.label,
                        controller: _tabController,
                        indicatorColor: Colors.red,
                        indicatorWeight: 2,
                        unselectedLabelStyle: TextStyle(
                            color: Colors.grey[600], // 下划线颜色
                            fontSize: 14,
                            fontWeight: FontWeight.w600),
                        labelStyle: TextStyle(
                            color: Colors.white,
                            fontSize: 14,
                            fontWeight: FontWeight.w700), //标签文字大小颜色
                        tabs: _tabs,
                      )),
                ),
                body: Container(
                  color: Colors.white,
                  child: ExtendedTabBarView(
                    controller: _tabController,
                    children: _tabsContent,
                  ),
                )));
  }
}
